package com.qf.swagger.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

@RestController
public class FenxiController {
    @RequestMapping("/fenxi")
    public Map<String,Object> fenxi(HttpServletRequest request){
        final Map<String, Object> map = new HashMap<>();
        final Map<String, Object> paramMap = new HashMap<>();
       //final String parameter = request.getParameter("age");
        //获取所有参数名
        final Enumeration<String> parameterNames = request.getParameterNames();
        //遍历所有参数名
        while (parameterNames.hasMoreElements()) {
            final String nextElement = parameterNames.nextElement();
            final String parameter = request.getParameter(nextElement);
            paramMap.put(nextElement,parameter);
        }
        return paramMap;
    }
}
